package com.mycode.controller;

import com.mycode.domain.ResponseResult;
import com.mycode.service.TAccountService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.math.BigDecimal;

/**
 * @author Zengsh123
 * @date 2020-03-17 16:23
 */
@RestController
public class AccountController {
    @Resource
    private TAccountService accountService;

    @PostMapping("account/decrease")
    public ResponseResult decrease(@RequestParam("userId") Long userId,
                                   @RequestParam("money") BigDecimal money) {
        accountService.decrease(userId, money);
        return new ResponseResult(200, "扣减账户余额成功");
    }
}
